<%--
  Created by IntelliJ IDEA.
  User: 潘达
  Date: 2020/4/9
  Time: 10:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>代理商管理系统</title>
    <link rel="stylesheet" type="text/css" href="../static/css/public.css">
    <link rel="stylesheet" type="text/css" href="../static/css/main.css">
    <script type="text/javascript" src="../static/js/jquery-3.4.0.js"></script>
    <script type="text/javascript">
        $(function () {
            $("input[name='submit']").click(function () {
                var data = $("#form").serialize();
                alert(data);
                $.ajax({
                    url:"http://localhost:8080/user/addUser",
                    data:data,
                    type:"post",
                    success:function (data) {
                        if(data == "success"){
                            alert("注册成功！");
                            window.location = "http://localhost:8080";
                        }else if(data == "error"){
                            alert("该用户名已存在");
                        }
                    },
                    dataType:"json"
                });
            });
        });
    </script>
</head>
<body>
    <div class="head">
        <ul>
            <li><h2>AgentSystem</h2>
            <li class="headfunc"></li>
        </ul>
    </div>
    <div id="menu"></div>
    <div class="container">
        <form id="form">
            <ul class="loginul">
                <li>登录账号:<input type="text" name="userCode"/>
                <li>用户名称:<input type="text" name="userName"/>
                <li>登录密码:<input type="text" name="userPassword"/>
             </ul>
            <input type="button" value="注册" name="submit"/>
            <input type="reset" value="重置"/>
        </form>
    </div>
</body>
</html>
